/*
 * @Author: adolphus adolphus520@163.com
 * @Date: 2022-12-11 22:29:08
 * @LastEditors: 姚杰鸿
 * @LastEditTime: 2025-01-23 15:49:11
 * @Description: file content
 */
import req from "@/lib/axios";

export const DepartmentApi = (info: string, attr: boolean, tree: boolean) =>
  req({
    url: `/department${info}`,
    method: "get",
    headers: {
      "q-attr-info": attr ? "1" : "",
      "q-tree-info": tree ? "1" : "",
    },
  });

export const GetDepartmentApi = (code: string) =>
  req({
    url: `/department/${code}`,
    method: "get",
  });

export const IsValidDepartmentCodeApi = (id: number, code: string) =>
  req({
    url: `/department/valid/${id}/${code}`,
    method: "get",
  });

export const DepartmentPostApi = (department: any) =>
  req({ url: "/department", method: "post", data: department });

export const DepartmentDeleteApi = (department: any) =>
  req({ url: `/department/${department.code}`, method: "delete" });

export const DepartmentUserDeleteApi = (department: any, user: any) =>
  req({
    url: `/department/user/${department.code}/${user.account}`,
    method: "delete",
  });

export const DepartmentUserPutApi = (department: any, users: any[]) =>
  req({
    url: `/department/user/${department.code}`,
    method: "put",
    data: users,
  });
